#!/usr/bin/env python3

"""
Module for initializing a SpecDB database
"""

import os
import sqlite3

def init(location=""):
	"""
	Initialize a SpecDB database file. 
	
	Parameters
	----------
	+ location		file-system location to initialize a db
	
	Returns
	-------
	+ Bool			True if db was made, else False
	"""
	
	assert(location)
	specdb_path = os.path.abspath(os.path.dirname(__file__))
	sql_path = os.path.join(specdb_path, '../sql/specdb.sql')
	
	conn = sqlite3.connect(location)
	c = conn.cursor()
	with open(sql_path) as fp:
		c.executescript(fp.read())
		return True